package com.speedricemanager.activity.home.registeframent;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.speedricemanager.R;
import com.speedricemanager.activity.home.registeframent.presenter.RegisterauditFramentPersenter;
import com.speedricemanager.activity.home.registeframent.view.RegisterauditFrament_Inter;
import com.speedricemanager.activity.home.registerauditlist.RegisterAuditLIst;
import com.speedricemanager.other.base.BaseFgm;
import com.wuxiaolong.pullloadmorerecyclerview.PullLoadMoreRecyclerView;

import butterknife.ButterKnife;
import butterknife.InjectView;


public class RegisterauditFrament extends BaseFgm implements RegisterAuditLIst.OnCallAoom,RegisterauditFrament_Inter {

    public static int tags=0;
    public static String stat="1";
    public int regis=4;
    @InjectView(R.id.dianfupullLoadMoreRecyclerView)
    PullLoadMoreRecyclerView dianfupullLoadMoreRecyclerView;
    private  static boolean isVisibleToUsers=false;
    RegisterauditFramentPersenter registerauditFramentPersenter;
    @Override
    public void setOnClick(String statics, int tag) {
        stat = statics;
        registerauditFramentPersenter.initData();
    } View view;
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
     view = LayoutInflater.from(getContext()).inflate(R.layout.registeraydutlis_layout, container, false);
        ButterKnife.inject(this, view);
        dianfupullLoadMoreRecyclerView.setLinearLayout();
      /*  dianfupullLoadMoreRecyclerView.setPushRefreshEnable(false);
        dianfupullLoadMoreRecyclerView.setPullRefreshEnable(false);*/
         registerauditFramentPersenter=new RegisterauditFramentPersenter(getActivity(),this);
        if(getUserVisibleHint()) {
            if (!isVisibleToUsers){
            registerauditFramentPersenter.initData();
            isVisibleToUsers = true;}
            Log.e("main",isVisibleToUsers+"");
        } else {
//            isVisibleToUsers = false;

        }


//        if (tags == 0 && isVisibleToUsers == true) {
//            registerauditFramentPersenter.initData();
//            tags=-1;
//        }
        registerauditFramentPersenter.getOnPullLoad();
        return view;
    }


//    @Override
//    public void setUserVisibleHint(boolean isVisibleToUser) {
//        super.setUserVisibleHint(isVisibleToUser);
//        if(getUserVisibleHint()) {
//            isVisibleToUsers = true;
//        } else {
//            isVisibleToUsers = false;
//
//        }
//
//    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }
    @Override
    public String getstatic() {
        return stat;
    }
    @Override
    public int getTags() {
        return regis;
    }
    @Override
    public PullLoadMoreRecyclerView dianfupullLoadMoreRecyclerView() {
        return dianfupullLoadMoreRecyclerView;
    }

    @Override
    public EditText editousuo() {
        return null;
    }

    @Override
    public TextView startime() {
        return null;
    }

    @Override
    public TextView enttime() {
        return null;
    }
}
